import 'package:flutter/material.dart';

main() => runApp(MyApp());

class MyApp extends StatelessWidget {
  const MyApp({Key key}) : super(key: key);

  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      home: LJHomePage(),
    );
  }
}

class LJHomePage extends StatelessWidget {
  const LJHomePage({Key key}) : super(key: key);

  @override
  Widget build(BuildContext context) {
    return Scaffold(
      appBar: AppBar(
        title: Center(
          child: Text("商品列表"),
        ),
      ),
      body: LJHomeContent(),
    );
  }
}

class LJHomeContent extends StatelessWidget {
  const LJHomeContent({Key key}) : super(key: key);

  @override
  Widget build(BuildContext context) {
    return ListView(
      children: [
        LJHomeProductItem("title","说明","https://tva1.sinaimg.cn/large/006y8mN6gy1g72j6nk1d4j30u00k0n0j.jpg"),
        LJHomeProductItem("title","说明","https://tva1.sinaimg.cn/large/006y8mN6gy1g72j6nk1d4j30u00k0n0j.jpg"),
        LJHomeProductItem("title","说明","https://tva1.sinaimg.cn/large/006y8mN6gy1g72j6nk1d4j30u00k0n0j.jpg")
      ],
    );
  }
}

class LJHomeProductItem extends StatelessWidget {
  // const LJHomeProductItem({Key key}) : super(key: key);

  final String title;
  final String desc;
  final String imageUrl;
  LJHomeProductItem(this.title,this.desc,this.imageUrl);

  final style = TextStyle(fontSize: 24,color: Colors.blue);

  @override
  Widget build(BuildContext context) {
    return Container(
      padding: EdgeInsets.all(12),
      decoration: BoxDecoration(
          border: Border.all(
            width: 5,
            color: Colors.orange,
          )
      ),
      child: Column(
        crossAxisAlignment: CrossAxisAlignment.start,
        children: [
          Text(title,style: style,),
          SizedBox(height: 8),
          Text(desc,style: style,),
          SizedBox(height: 8),
          Image.network(imageUrl)
        ],
      ),
    );
  }
}